<include file="Public/header" />
<include file="Public/menu" />

<!-- 内容页 -->
<div class="content-wrapper">
    <!-- 面包屑 -->
    <section class="content-header">
        <h1>
            店铺配置
            <small>管理</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 店铺配置</a></li>
            <li class="active">发货信息管理</li>
        </ol>
    </section>

    <!-- 内容 -->
    <section class="content"><div class="row"><div class="col-md-12"><div class="box">
        <div class="box-header">
            <h3 class="box-title"></h3>

            <div class="btn-group pull-left" style="margin-right: 10px">
                <a href="/admin/Delivery/deliveryInfoAdd" class="btn btn-sm btn-success"><i class="fa fa-save"></i>&nbsp;&nbsp;新增发货信息</a>
            </div>

        </div>
        <!-- /.box-header -->
        <div class="box-body table-responsive no-padding">
            <table class="table table-hover">
                <tbody>
                <tr>
                    <th>ID</th>
                    <th>操作</th>
                    <th>地区</th>
                    <th>发货地址</th>
                    <th>姓名</th>
                    <th>手机</th>


                    <th>性别</th>
                    <th>备注</th>
                </tr>
                <volist name="list" id="info">
                <tr>

                    <td>{$i}</td>
                    <td>
                        <a href="{:U('/admin/Delivery/deliveryInfoEdit',array('id'=>$info['dly_center_id']))}"><i class="fa fa-edit"></i></a>
                        <a  href="javascript:void(0);" class="is_delete" data-id="{$info['dly_center_id']}"><i class="fa fa-trash"></i></a>
                    </td>
                    <td>{$info['region']}</td>
                    <td>{$info['address']}</td>
                    <td>{$info['uname']}</td>
                    <td>{$info['cellphone']}</td>

                    <if condition="$info['sex'] eq 'male'">
                    <td>先生</td>
                        <else/>
                    <td>女士</td>
                    </if>
                    <td>{$info['memo']}</td>

                </tr>
                </volist>
                </tbody>
            </table>
        </div>


        <!-- /.box-body -->
    </div></div></div>

    </section>
</div>
<!-- 底部 -->
<include file="Public/common_footer" />

<script data-exec-on-popstate>
    

    
    $(function () {
        $('.is_delete').on('click',function () {
            $_this = $(this);
            if(confirm('确定删除该内容吗？')){
               // console.log($_this.parent().parent());
                $.ajax({
                    type:'post',
                    data:{'id':$_this.data('id')},
                    url:'/Admin/Delivery/deliveryInfoDelete',
                    success:function (data) {
                        if(data.status==1){
                            alert(data.msg);
                            $_this.parent().parent().remove();
                        }else{
                            alert(data.msg);
                        }
                    },
                    error:function () {
                        alert('参数错误');
                    }
                })

            }
        })

        $('.batch-delete').on('click', function() {
            var selected = [];
            $('.grid-item:checked').each(function(){
                selected.push($(this).data('id'));
            });

            if (selected.length == 0) {
                return;
            }

            if(confirm("Are you sure to delete this item ?")) {
                $.post('/admin/auth/roles/' + selected.join(), {_method:'delete','_token':'ALpaP7hXZ6s2dnAdE02Z6mUSHPt8RkYbcDRp6rpw'}, function(data){
                    $.pjax.reload('#pjax-container');
                    noty({
                        text: "<strong>Succeeded!</strong>",
                        type:'success',
                        timeout: 1000
                    });
                });
            }
        });
    });
</script>